package com.xy;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/22 15:09
 * @description
 */
public class Client {
    public static void main(String[] args) {
        // 采购器材请求
        PurchaseRequest purchaseRequest1 = new PurchaseRequest(1, 3000, 1);
        PurchaseRequest purchaseRequest2 = new PurchaseRequest(2, 9000, 2);
        PurchaseRequest purchaseRequest3 = new PurchaseRequest(3, 24000, 3);
        PurchaseRequest purchaseRequest4 = new PurchaseRequest(4, 100000, 4);

        // 所有处理类
        Approver departmentApprover = new DepartmentApprover("教导主任");
        Approver collegeApprover = new CollegeApprover("学院院长");
        Approver viceSchoolMasterApprover = new ViceSchoolMasterApprover("副校长");
        Approver schoolMasterApprover = new SchoolMasterApprover("校长");

        // 设置职责链
        departmentApprover.setApprover(collegeApprover);
        collegeApprover.setApprover(viceSchoolMasterApprover);
        viceSchoolMasterApprover.setApprover(schoolMasterApprover);

        // 处理请求
        departmentApprover.processRequest(purchaseRequest1);
        departmentApprover.processRequest(purchaseRequest2);
        departmentApprover.processRequest(purchaseRequest3);
        departmentApprover.processRequest(purchaseRequest4);
    }
}
